package com.banciyuan.bcywebview.base.view.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.banciyuan.bcywebview.R;

/**
 * Created by squall on 2016/5/16.
 */
public class ChargeSuccDialog extends Dialog {

    private boolean showNormalPic = true;
    private TextView comment;
    private ImageView close_iv;
    private View.OnClickListener onClickListener;

    public ChargeSuccDialog(Context context) {
        super(context);
    }

    public ChargeSuccDialog(Context context, int theme) {
        super(context, theme);
    }

    protected ChargeSuccDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public void showNormalPic(boolean showNormalPic) {
        this.showNormalPic = showNormalPic;
    }

    public void setDetailType(View.OnClickListener onClick) {
        this.onClickListener = onClick;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.charge_succ);
        close_iv = (ImageView) findViewById(R.id.close_iv);
        comment = (TextView) findViewById(R.id.leave_message);
        if (showNormalPic) {
            findViewById(R.id.iv_showingpic).setVisibility(View.VISIBLE);
            findViewById(R.id.iv_showingbigpic).setVisibility(View.GONE);
        } else {
            findViewById(R.id.iv_showingpic).setVisibility(View.GONE);
            findViewById(R.id.iv_showingbigpic).setVisibility(View.VISIBLE);
        }
        close_iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        comment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickListener.onClick(v);
                dismiss();
            }
        });
    }
}
